/*
** Lua binding: mytolua
** Generated automatically by tolua++-1.0.92 on 06/23/08 01:53:37.
*/

#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "tolua++.h"

/* Exported function */
TOLUA_API int  tolua_mytolua_open (lua_State* tolua_S);

#include "interface.h"

/* function to release collected object via destructor */
#ifdef __cplusplus

static int tolua_collect_Ss (lua_State* tolua_S)
{
 Ss* self = (Ss*) tolua_tousertype(tolua_S,1,0);
	Mtolua_delete(self);
	return 0;
}
#endif


/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
 tolua_usertype(tolua_S,"Ss");
}

/* method: new of class  Ss */
#ifndef TOLUA_DISABLE_tolua_mytolua_Ss_new00
static int tolua_mytolua_Ss_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"Ss",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   Ss* tolua_ret = (Ss*)  Mtolua_new((Ss)());
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"Ss");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  Ss */
#ifndef TOLUA_DISABLE_tolua_mytolua_Ss_new00_local
static int tolua_mytolua_Ss_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"Ss",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   Ss* tolua_ret = (Ss*)  Mtolua_new((Ss)());
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"Ss");
    tolua_register_gc(tolua_S,lua_gettop(tolua_S));
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* get function: i of class  Ss */
#ifndef TOLUA_DISABLE_tolua_get_Ss_i
static int tolua_get_Ss_i(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'i'",NULL);
#endif
  tolua_pushnumber(tolua_S,(lua_Number)self->i);
 return 1;
}
#endif //#ifndef TOLUA_DISABLE

/* set function: i of class  Ss */
#ifndef TOLUA_DISABLE_tolua_set_Ss_i
static int tolua_set_Ss_i(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  tolua_Error tolua_err;
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'i'",NULL);
  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->i = ((int)  tolua_tonumber(tolua_S,2,0))
;
 return 0;
}
#endif //#ifndef TOLUA_DISABLE

/* get function: a of class  Ss */
#ifndef TOLUA_DISABLE_tolua_get_Ss_a
static int tolua_get_Ss_a(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'a'",NULL);
#endif
  tolua_pushnumber(tolua_S,(lua_Number)self->a);
 return 1;
}
#endif //#ifndef TOLUA_DISABLE

/* set function: a of class  Ss */
#ifndef TOLUA_DISABLE_tolua_set_Ss_a
static int tolua_set_Ss_a(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  tolua_Error tolua_err;
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'a'",NULL);
  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->a = ((char)  tolua_tonumber(tolua_S,2,0))
;
 return 0;
}
#endif //#ifndef TOLUA_DISABLE

/* get function: b of class  Ss */
#ifndef TOLUA_DISABLE_tolua_get_Ss_b
static int tolua_get_Ss_b(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'b'",NULL);
#endif
  tolua_pushnumber(tolua_S,(lua_Number)self->b);
 return 1;
}
#endif //#ifndef TOLUA_DISABLE

/* set function: b of class  Ss */
#ifndef TOLUA_DISABLE_tolua_set_Ss_b
static int tolua_set_Ss_b(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  tolua_Error tolua_err;
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'b'",NULL);
  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->b = ((double)  tolua_tonumber(tolua_S,2,0))
;
 return 0;
}
#endif //#ifndef TOLUA_DISABLE

/* get function: str of class  Ss */
#ifndef TOLUA_DISABLE_tolua_get_Ss_str
static int tolua_get_Ss_str(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'str'",NULL);
#endif
  tolua_pushcppstring(tolua_S,(const char*)self->str);
 return 1;
}
#endif //#ifndef TOLUA_DISABLE

/* set function: str of class  Ss */
#ifndef TOLUA_DISABLE_tolua_set_Ss_str
static int tolua_set_Ss_str(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  tolua_Error tolua_err;
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'str'",NULL);
  if (!tolua_iscppstring(tolua_S,2,0,&tolua_err))
   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->str = ((string)  tolua_tocppstring(tolua_S,2,0))
;
 return 0;
}
#endif //#ifndef TOLUA_DISABLE

/* get function: chararray of class  Ss */
#ifndef TOLUA_DISABLE_tolua_get_Ss_chararray
static int tolua_get_Ss_chararray(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'chararray'",NULL);
#endif
  tolua_pushstring(tolua_S,(const char*)self->chararray);
 return 1;
}
#endif //#ifndef TOLUA_DISABLE

/* set function: chararray of class  Ss */
#ifndef TOLUA_DISABLE_tolua_set_Ss_chararray
static int tolua_set_Ss_chararray(lua_State* tolua_S)
{
  Ss* self = (Ss*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  tolua_Error tolua_err;
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'chararray'",NULL);
  if (!tolua_istable(tolua_S,2,0,&tolua_err))
   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
 strncpy(self->chararray,tolua_tostring(tolua_S,2,0),10-1);
 return 0;
}
#endif //#ifndef TOLUA_DISABLE

/* function: printHi */
#ifndef TOLUA_DISABLE_tolua_mytolua_printHi00
static int tolua_mytolua_printHi00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isnoobj(tolua_S,1,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   int tolua_ret = (int)  printHi();
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'printHi'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* Open function */
TOLUA_API int tolua_mytolua_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"Ss","Ss","",tolua_collect_Ss);
  #else
  tolua_cclass(tolua_S,"Ss","Ss","",NULL);
  #endif
  tolua_beginmodule(tolua_S,"Ss");
   tolua_function(tolua_S,"new",tolua_mytolua_Ss_new00);
   tolua_function(tolua_S,"new_local",tolua_mytolua_Ss_new00_local);
   tolua_function(tolua_S,".call",tolua_mytolua_Ss_new00_local);
   tolua_variable(tolua_S,"i",tolua_get_Ss_i,tolua_set_Ss_i);
   tolua_variable(tolua_S,"a",tolua_get_Ss_a,tolua_set_Ss_a);
   tolua_variable(tolua_S,"b",tolua_get_Ss_b,tolua_set_Ss_b);
   tolua_variable(tolua_S,"str",tolua_get_Ss_str,tolua_set_Ss_str);
   tolua_variable(tolua_S,"chararray",tolua_get_Ss_chararray,tolua_set_Ss_chararray);
  tolua_endmodule(tolua_S);
  tolua_function(tolua_S,"printHi",tolua_mytolua_printHi00);
 tolua_endmodule(tolua_S);
 return 1;
}


#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
 TOLUA_API int luaopen_mytolua (lua_State* tolua_S) {
 return tolua_mytolua_open(tolua_S);
};
#endif

